package com.tqfframe.rabbitmq.listener.direct;

import com.tqfframe.rabbitmq.constants.RabbitConstants;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 普通消息队列监听方式1
 * @author: Qifeng Tang
 * @date: 2022/11/14 11:36
 * @Version 1.0
 **/

//@Component
//@RabbitListener(queuesToDeclare = @Queue(RabbitConstants.COMMON_QUEUE))  // queuesToDeclare 自动声明队列。需要搭配注入。
public class CommonReceiver {

    @RabbitHandler
    public void receive(String in) {
        System.out.println("我是普通消息，我消费了"+in);
    }

}
